package com.rt.easyjava.base.biz1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rt.easyjava.base.biz1.bean.TmptTbColumnBiz;
import com.rt.easyjava.base.biz1.dto.TmptTbColumnBizDto;
import com.rt.easyjava.base.biz1.mapper.TmptTbColumnBizMapper;
import com.rt.easyjava.base.biz1.service.impl.base.TmptTbColumnServiceImpl;
import com.rt.easyjava.base.biz1.service.intf.TmptTbColumnBizService;
import com.rt.easyjava.common.base.Result;
import com.rt.easyjava.common.config.dozer.MyMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 *  服务实现类
 * @author wuxiaoyong
 * @since 2020-07-04
 */
@Slf4j
@Service(value = "tmptTbColumnService")
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class TmptTbColumnBizServiceImpl extends TmptTbColumnServiceImpl implements TmptTbColumnBizService{
    @Autowired
    private MyMapper mapper;
    @Resource
    private TmptTbColumnBizMapper tmptTbColumnBizMapper;

    // ==================================================================================
    // ========== 以下使用的是 Mybatis-plus 实现, 适合单表操作 ==============================
    // ==================================================================================

    /**
    * create a object
    * @param tmptTbColumnBizDto
    * @return
    */
    @Override
    public Result<TmptTbColumnBizDto> create(TmptTbColumnBizDto tmptTbColumnBizDto) {
        return super.create(tmptTbColumnBizDto);
    }

    /**
    * update a object by Id
    * @param tmptTbColumnBizDto
    * @param updateWrapper
    * @return
    */
    @Override
    public Result<TmptTbColumnBizDto> update(TmptTbColumnBizDto tmptTbColumnBizDto, UpdateWrapper updateWrapper) {
        return super.update(tmptTbColumnBizDto, updateWrapper);
    }

    /**
    * 分页 (无合计功能)
    * @param page
    * @param queryWrapper
    * @return
    */
    public Result<TmptTbColumnBizDto> page(Page<TmptTbColumnBiz> page, QueryWrapper<TmptTbColumnBiz> queryWrapper){
        return super.page(page, queryWrapper);
    }

    /**
    * select all by queryWrapper
    * @param queryWrapper
    * @return
    */
    @Override
    public Result<TmptTbColumnBizDto> selectBy(QueryWrapper<TmptTbColumnBiz> queryWrapper) {
        return super.selectBy(queryWrapper);
    }

    /**
    * select one by id
    * @param id
    * @return
    */
    @Override
    public Result<TmptTbColumnBizDto> selectById(Long id) {
        return super.selectById(id);
    }




    // ==================================================================================
    // ========== 以下使用的是自定义的 mapper.xml 实现, 适合多表查询 =========================
    // ==================================================================================

    /**
    * 分页查询：mybatis plus 自定义sql分页查询
    * 默认开启合计查询，按需注掉代码
    * @param page
    * @param queryWrapper
    * @return
    */
    @Override
    public Result<TmptTbColumnBizDto> myPage(Page<TmptTbColumnBiz> page, QueryWrapper<TmptTbColumnBiz> queryWrapper) {
        return super.myPage(page, queryWrapper);
    }

    @Override
    public Result<TmptTbColumnBizDto> mySelectBy(QueryWrapper<TmptTbColumnBiz> queryWrapper) {
        return super.mySelectBy(queryWrapper);
    }

    @Override
    public Result<TmptTbColumnBizDto> mySelectById(long id) {
        return super.mySelectById(id);
    }

}
